import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { Utility, Refresh, GxIcon, InfoItemList, ReplyList, Input } from 'components';
import * as CommonActions from 'redux/modules/reduxCommon';
import * as TaskActions from 'redux/modules/reduxTask';
// import { Input } from 'antd';
const TextArea = Input.TextArea;
const styles = require('./scss/Task.scss');

@connect(
  state => ({
    Title: state.Common.Title,                                          // 标题
    UrlParams: state.Common.UrlParams,                                  // URL参数
    replyList: state.TaskManager.replyList,
  }),
  { ...CommonActions, ...TaskActions })

export default class Task extends Component {
  static propTypes = {
    UrlParams: PropTypes.object,                                       // Url参数
    replyList: PropTypes.object,                                       // 回复列表数据
    onTaskDetail: PropTypes.func,                                      // 查询详情信息
    onEditTask: PropTypes.func,                                        // 编辑任务接口
    onGetPeopleList: PropTypes.func,                                   // 人员列表接口
    onExtEditTask: PropTypes.func,                                     // 编辑任务接口 
    onGetReplyList: PropTypes.func,                                    // 获取回复列表接口
    onClearContent: PropTypes.func,                                      // 
  };

  constructor(props) {
    super(props);
    const { UrlParams } = this.props;
    const { token } = UrlParams;
    if (token) {
      Utility.setToken(token);
    }
    this.state = {
      pgIndex: 0,
      detail: { content: '' },
      isEdit: false,
      NextDataComplete: true,
      RefreshComplete: true,
      IsExistsNextData: true,
      userId: null,
      replyList: {},
    };
  }

  componentWillMount() {
    this.__getTaskDetail();
  }

  componentDidMount() {
    const option = { Title: '详情' };
    Utility.$emit(Utility.constItem.Events.OnEditNavBarTitle, option);
    Utility.$emit(Utility.constItem.Events.OnEditLeftAction, false);
    this.__maxWindow();
    // this.__getTaskDetail();
    const { onClearContent } = this.props;
    onClearContent(Utility.constItem.StateName.SelectWorkWay);
    onClearContent(Utility.constItem.StateName.SelectRepeatWay);
    onClearContent(Utility.constItem.StateName.SelectRemindType);
    onClearContent(Utility.constItem.StateName.SelectExecutePlanType);
  }

  componentWillUnmount() {
    delete this.state.IsMount;
  }

  /**
   * 最大化窗口
   * 
   * @memberof Task
   */
  __maxWindow() {
    const __self = this;
    if (window.GoCom) {
      window.GoCom.maxWindow();
    } else {
      setTimeout(() => {
        __self.__maxWindow();
      }, 100);
    }
    // setTimeout(() => {
    //   Utility.$platformApi.$maxWindow();
    // }, 0);
  }

  /**
   * 获取任务详情
   * 
   * @returns 
   * @memberof InitConerence
   */
  __getTaskDetail() {
    Utility.$loading();
    const { onTaskDetail, UrlParams } = this.props;
    if (!Utility.isFunction(onTaskDetail)) {
      return;
    }
    const taskId = UrlParams.taskId;
    onTaskDetail(taskId).then((result) => {
      Utility.$loadingHide();
      this.setState({ detail: result });
      const { userId } = this.state.detail || '';
      this.state.userId = userId;
      // if (result && result.role === Utility.constItem.User.User_Author) {
      this.__firstGetList();
      // }
    }, (error) => {
      Utility.$loadingHide();
      console.log(error);
    });
  }

  /**
   * 判断角色是否可以编辑
   * 
   * @returns 
   * @memberof Task
   */
  __onCheckCanEdit() {
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      // this.__hiddenNavBarRight();
      return false;
    }
    if (detail.role === Utility.constItem.User.User_Author &&
      detail.status !== Utility.constItem.Task.Task_OVER &&
      detail.status !== Utility.constItem.Task.Task_FINISHED &&
      detail.status !== Utility.constItem.Task.Task_REFUSE &&
      detail.status !== Utility.constItem.Task.Task_DELETE) {
      // const option2 = {
      //   RightType: Utility.constItem.NavBarRightType.NBButton, Color: '#00b7ee',
      //   Text: '编辑', onClick: this.__onEditClick.bind(this)
      // };
      // Utility.$emit(Utility.constItem.Events.OnEditNavBarRight, Utility.constItem.NavBarRightType.NBButton, option2);
      return true;
    }
    // this.__hiddenNavBarRight();
    return false;
  }

  __emptyClick() { }
  __hiddenNavBarRight() {
    const option2 = {
      RightType: Utility.constItem.NavBarRightType.NBButton, Color: '#00b7ee',
      Text: '', onClick: this.__emptyClick.bind(this)
    };
    Utility.$emit(Utility.constItem.Events.OnEditNavBarRight, Utility.constItem.NavBarRightType.NBButton, option2);
  }

  __close() {
    // const option2 = {RightType: Utility.constItem.NavBarRightType.NBButton, Color: '#00b7ee',
    //         Text: '编辑', onClick: this.__onEditClick.bind(this)};
    // Utility.$emit(Utility.constItem.Events.OnEditNavBarRight, Utility.constItem.NavBarRightType.NBButton, option2);
  }

  __onEditClick() {
    const {
      UrlParams
    } = this.props;
    const taskId = UrlParams.taskId;
    // const {content, status, extTaskUser } = this.state.detail || {};
    Utility.setTaskDetail(this.state.detail);
    Utility.toPage(Utility.constItem.UrlItem.EditTask, { taskId: taskId });
  }

  __toPage(url) {
    const {
      UrlParams
    } = this.props;
    const { userId } = this.state || '';
    const taskId = UrlParams.taskId;
    Utility.toPage(url, { taskId: taskId, userId: userId });
  }

  __onCompleteClick() {
    this.setState({ isEdit: false });
    const option2 = {
      RightType: Utility.constItem.NavBarRightType.NBButton, Color: '#00b7ee',
      Text: '编辑', onClick: this.__onEditClick.bind(this)
    };
    Utility.$emit(Utility.constItem.Events.OnEditNavBarRight, Utility.constItem.NavBarRightType.NBButton, option2);
    this.__onEditContentApi();
  }

  __showConfirm(msg) {
    const { OnConfirm
    } = Utility.constItem.Events.ShowModel;
    const option = { Content: msg, Title: '提示', okButton: this.__getTaskDetail.bind(this), cancelButton: this.__getTaskDetail.bind(this) };
    Utility.$emit(OnConfirm, option);
  }

  __onEditContentApi() {
    const input = this.refs.input;
    if (!input) {
      return;
    }
    const { content } = this.state.detail;
    if (input.textAreaRef.value === content) {
      return;
    }
    if (input.textAreaRef.value) {
      const putContent = { content: input.textAreaRef.value };
      this.__onEditTask(putContent);
    } else {
      alert('请输入内容');
    }
  }

  __onChangeTaskState(state) {
    this.setState({ isEdit: false });
    this.__hiddenNavBarRight();
    const Content = { status: state };
    const { detail } = this.state;
    if (detail.role === Utility.constItem.User.User_Author) {
      this.__onEditTask(Content);
    } else if (detail.role === Utility.constItem.User.User_Executor) {
      this.__onExtEditTask(Content);
    }
  }

  __perform() {
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      return;
    }
    if (detail.role === Utility.constItem.User.User_Executor && detail.status === Utility.constItem.Task.Task_START) {
      const Content = { status: Utility.constItem.Task.Task_RECEIVED };
      this.__onExtEditTask(Content, this.__perform.bind(this));
      return;
    }
    this.__toPage(Utility.constItem.UrlItem.Execute);
  }

  /**
   * 创建者修改状态
   * @param {any} arg 
   * @returns 
   * @memberof Task
   */
  __onEditTask(arg) {
    Utility.$loading();
    const { onEditTask, UrlParams } = this.props;
    if (!Utility.isFunction(onEditTask)) {
      return;
    }
    const taskId = UrlParams.taskId;
    onEditTask(taskId, arg).then((result) => {
      Utility.$loadingHide();
      this.setState({ detail: result });
      this.__onCheckCanEdit();
    }, (error) => {
      Utility.$loadingHide();
      this.__onCheckCanEdit();
      if (error && error.code === 804) {
        this.__showConfirm(error.message ? error.message : this.__getConfirmTxt(error.code));
      }
      console.log(error);
    });
  }

  /**
  * 执行者修改状态
  * @param {any} arg 
  * @returns 
  * @memberof Task
  */
  __onExtEditTask(arg, callback) {
    Utility.$loading();
    const { onExtEditTask, UrlParams } = this.props;
    if (!Utility.isFunction(onExtEditTask)) {
      return;
    }
    const taskId = UrlParams.taskId;
    onExtEditTask(taskId, arg).then((result) => {
      Utility.$loadingHide();
      this.setState({ detail: result });
      this.__onCheckCanEdit();
      if (callback) {
        callback();
      }
    }, (error) => {
      Utility.$loadingHide();
      this.__onCheckCanEdit();
      if (error && error.code === 804) {
        this.__showConfirm(error.message ? error.message : this.__getConfirmTxt(error.code));
      }
      console.log(error);
    });
  }

  __getConfirmTxt(code) {
    if (code) {
      return ('当前任务状态有变化，请重试！');
    }
    return ('当前任务状态有变化，请重试！');
  }

  __getContent() {
    const { isEdit } = this.state;
    const { content } = this.state.detail;
    if (!isEdit) {
      return (
        <div className={styles.detailcontent} >{content}</div>
      );
    }
    return (
      <TextArea className={styles.detailcontent} maxLength="1500" ref="input" defaultValue={content} autosize={{ minRows: 1, maxRows: 1500 }} />
    );
  }

  /**
   * 判断底部任务按钮
   * 
   * @param {any} styles 
   * @returns 
   * @memberof Task
   */
  __getButton() {
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      return null;
    }
    if (detail.role === Utility.constItem.User.User_Author) { // 创建者
      switch (detail.status) {
        case Utility.constItem.Task.Task_START:    // 未处理
        // break;
        case Utility.constItem.Task.Task_RECEIVED:  // 收到
        // break;
        case Utility.constItem.Task.Task_FINISHED:  // 完成
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_OVER)} className={styles.buttonLarge} >关闭</span>
            </div>
            // <div className={styles.button} onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_OVER)} ><span ref="text" className={styles.text}>关闭</span></div>
          );
        // break;
        case Utility.constItem.Task.Task_REFUSE:   // 拒绝
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已拒绝</span>
            </div>
            // <div className={styles.buttonDisable} ><span ref="text" className={styles.text}>已拒绝</span></div>
          );
        case Utility.constItem.Task.Task_OVER:     // 结束
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已关闭</span>
            </div>
            // <div className={styles.buttonDisable} ><span ref="text" className={styles.text}>已关闭</span></div>
          );
        case Utility.constItem.Task.Task_DELETE:     // 结束
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已删除</span>
            </div>
            // <div className={styles.buttonDisable} ><span ref="text" className={styles.text}>已删除</span></div>
          );
        default:
          break;
      }
    } else if (detail.role === Utility.constItem.User.User_Executor) { // 执行者
      switch (detail.status) {
        case Utility.constItem.Task.Task_START:    // 未处理
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonleft} onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_FINISHED)}>完成</span>
              <div className={styles.line} />
              <span className={styles.buttonright} onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_REFUSE)}>拒绝</span>
            </div>
          );
        case Utility.constItem.Task.Task_RECEIVED:  // 收到
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonleft} onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_FINISHED)}>完成</span>
              <div className={styles.line} />
              <span className={styles.buttonright} onClick={this.__onChangeTaskState.bind(this, Utility.constItem.Task.Task_REFUSE)}>拒绝</span>
            </div>
          );
        // break;
        case Utility.constItem.Task.Task_FINISHED:  // 完成
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已完成</span>
            </div>
          );
        case Utility.constItem.Task.Task_REFUSE:   // 拒绝
          return (
            <div className={styles.button}>
              <div className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已拒绝</span>
            </div>
          );
        case Utility.constItem.Task.Task_OVER:     // 结束
          return (
            <div className={styles.button}>
              <div onClick={this.__perform.bind(this)} className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已关闭</span>
            </div>
          );
        case Utility.constItem.Task.Task_DELETE:     // 结束
          return (
            <div className={styles.button}>
              <div className={styles.perform}>
                <div className={styles.icon}>
                  <GxIcon IconType="iconPerform" />
                </div>
                <div className={styles.icontext}>执行</div>
              </div>
              <span className={styles.buttonLargeDisable} >已删除</span>
            </div>
          );
        default:
          break;
      }
    } else if (detail.role === Utility.constItem.User.User_Participant) {
      return null;
    } else {
      return null;
    }
  }

  __hasButton() {
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      return false;
    }
    if (detail.role === Utility.constItem.User.User_Author) { // 创建者
      switch (detail.status) {
        case Utility.constItem.Task.Task_START:    // 未处理
        // break;
        case Utility.constItem.Task.Task_RECEIVED:  // 收到
        // break;
        case Utility.constItem.Task.Task_FINISHED:  // 完成
          return true;
        // break;
        case Utility.constItem.Task.Task_REFUSE:   // 拒绝
          return true;
        case Utility.constItem.Task.Task_OVER:     // 结束
          return true;
        default:
          return false;
      }
    } else if (detail.role === Utility.constItem.User.User_Executor) { // 执行者
      switch (detail.status) {
        case Utility.constItem.Task.Task_START:    // 未处理
          return true;
        case Utility.constItem.Task.Task_RECEIVED:  // 收到
          return true;
        case Utility.constItem.Task.Task_FINISHED:  // 完成
          return true;
        case Utility.constItem.Task.Task_REFUSE:   // 拒绝
          return true;
        case Utility.constItem.Task.Task_OVER:     // 结束
          return true;
        default:
          return false;
      }
    } else if (detail.role === Utility.constItem.User.User_Participant) {
      return false;
    } else {
      return false;
    }
  }

  __getCanReject() {
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      return false;
    }
    if (detail.role === Utility.constItem.User.User_Executor && detail.status === Utility.constItem.Task.Task_START) {
      return true;
    }
    if (detail.role === Utility.constItem.User.User_Executor && detail.status === Utility.constItem.Task.Task_RECEIVED) {
      return true;
    }
    return false;
  }

  __getPeople() {
    const { fromUserTrueName, role } = this.state.detail;
    let people = { type: '创建', name: fromUserTrueName ? fromUserTrueName : '' };
    if (role) {
      if (role === Utility.constItem.User.User_Author || role === Utility.constItem.User.User_Participant) {
        people = { type: '创建', name: fromUserTrueName ? fromUserTrueName : '' };
      } else {
        people = { type: '创建', name: fromUserTrueName ? fromUserTrueName : '' };
      }
    } else {
      people = { type: '创建', name: fromUserTrueName ? fromUserTrueName : '' };
    }
    return people;
  }

  __onRefresh() {
  }

  __firstGetList() {
    const {
      UrlParams
    } = this.props;
    const taskId = UrlParams.taskId;
    const { onGetReplyList } = this.props;
    const Condition = { IsExistsNextData: true };
    onGetReplyList(taskId, Condition).then((result) => {
      if (result) {
        const {
         replyList
       } = this.props;
        this.setState({ replyList: replyList });
      }
    }, () => {
      // this.setState({NextDataComplete: true});
    });
  }

  __onNextData() {
    const { onGetReplyList } = this.props;
    const { replyList } = this.state;
    const { Condition } = replyList || { IsExistsNextData: true };
    if (!Condition.IsExistsNextData) {
      return;
    }
    this.setState({ NextDataComplete: false });
    const {
      UrlParams
    } = this.props;
    const taskId = UrlParams.taskId;
    onGetReplyList(taskId, Condition).then((result) => {
      if (result) {
        this.setState({ peopleList: this.props.replyList, NextDataComplete: true });
      } else {
        this.setState({ NextDataComplete: true });
      }
    }, () => {
      this.setState({ NextDataComplete: true });
    });
  }

  __getState(status) {
    let statusStr = '';
    if (!status) {
      return '';
    }
    const { detail } = this.state;
    if (!detail || !detail.role || !detail.status) {
      return '';
    }
    if (detail.role === Utility.constItem.User.User_Author) { // 创建者
      switch (status) {
        case Utility.constItem.Task.Task_START:    // 未处理
          statusStr = '未处理';
          break;
        case Utility.constItem.Task.Task_RECEIVED:  // 收到
          statusStr = '进行中';
          break;
        case Utility.constItem.Task.Task_FINISHED:  // 完成
          statusStr = '进行中';
          break;
        case Utility.constItem.Task.Task_REFUSE:   // 拒绝
          statusStr = '进行中';
          break;
        case Utility.constItem.Task.Task_OVER:     // 结束
          statusStr = '已关闭';
          break;
        default:
          statusStr = '进行中';
          break;
      }
      return statusStr;
    }
    switch (status) {
      case Utility.constItem.Task.Task_START:    // 未处理
        statusStr = '未处理';
        break;
      case Utility.constItem.Task.Task_RECEIVED:  // 收到
        statusStr = '已收到';
        break;
      case Utility.constItem.Task.Task_FINISHED:  // 完成
        statusStr = '已完成';
        break;
      case Utility.constItem.Task.Task_REFUSE:   // 拒绝
        statusStr = '已拒绝';
        break;
      case Utility.constItem.Task.Task_OVER:     // 结束
        statusStr = '已关闭';
        break;
      default:
        break;
    }
    return statusStr;
  }

  __getExtTaskUser(extTaskUser) {
    let ExtTaskUser = '';
    const temp = [];
    if (extTaskUser && extTaskUser.length < 4 && extTaskUser.length > 0) {
      extTaskUser.map((obj) => {
        temp.push(obj.taskUserName);
      });
      ExtTaskUser = temp.join(',');
    } else if (extTaskUser && extTaskUser.length > 3) {
      ExtTaskUser = extTaskUser[0].taskUserName + ',' + extTaskUser[1].taskUserName + ',' + extTaskUser[2].taskUserName + '等' + extTaskUser.length + '人';
    }
    return ExtTaskUser;
  }

  /**
   * 执行计划
   * 
   * @param {any} execPlan 
   * @returns 
   * @memberof Task
   */
  __ExecutePlanHtml(execPlan) {
    if (!execPlan) {
      return null;
    }
    let __executePlan = '轻任务';
    switch (execPlan) {
      case 'LIGTH':
        __executePlan = '轻任务';
        break;
      case 'STANDARD':
        __executePlan = '标准任务';
        break;
      case 'MEETING':
        __executePlan = '晨会';
        break;
      default:
        break;
    }
    return __executePlan;
  }

  /**
   * 提醒字段
   * 
   * @param {any} isRemind 
   * @returns 
   * @memberof Task
   */
  __RemindHtml(isRemind) {
    if (!isRemind) {
      return null;
    }
    let __remindTip = '不提醒';
    switch (isRemind) {
      case 'NO':
        __remindTip = '不提醒';
        break;
      case 'QUARTER':
        __remindTip = '截止十五分钟前';
        break;
      case 'HOUR':
        __remindTip = '截止一小时前';
        break;
      case 'THREEHOUR':
        __remindTip = '截止三小时前';
        break;
      case 'ONEDAY':
        __remindTip = '截止前一天';
        break;
      default:
        break;
    }
    return __remindTip;
  }

  /**
   * 标签样式
   * 
   * @param {any} label 
   * @returns 
   * @memberof TaskList
   */
  __LabelStyle(label) {
    if (!label || label === '') {
      return null;
    }
    // let result = [];
    const labels = label.split(',');
    const result = labels.reverse();
    // if (!Utility.isArray(result)) {
    //   result = ['标签'];
    // } else {
    //   result = label.split(',');
    // }
    if (!Utility.isArray(result)) {
      return null;
    }
    const __label = [];
    const __result = result.slice(0, 3);
    for (let i = 0; i < __result.length; i++) {
      const item = result[i];
      switch (item) {
        case '紧急':
          __label.unshift(<div className={styles.oneStatus} key={'one_status'}>紧急</div>);
          break;
        case '重要':
          __label.unshift(<div className={styles.twoStatus} key={'two_status'}>重要</div>);
          break;
        case '普通':
          __label.unshift(<div className={styles.threeStatus} key={'three_status'}>普通</div>);
          break;
        default:
          // __label.unshift(<div className={styles.defaultCss} key={'other_status'}>{item}</div>);
          break;
      }
    }
    return (<div className={styles.labelContainer}>{__label}</div>);
  }

  /**
   * 是否重复
   * 
   * @param {any} isRepeat 
   * @returns 
   * @memberof Task
   */
  __IsRepeatHtml(isRepeat) {
    if (!isRepeat) {
      return null;
    }
    let _isRepeat = '不重复';
    switch (isRepeat) {
      case 'NO':
        _isRepeat = '不重复';
        break;
      case 'DAY':
        _isRepeat = '每天重复';
        break;
      case 'WEEK':
        _isRepeat = '每周重复';
        break;
      default:
        break;
    }
    return _isRepeat;
  }

  render() {
    const { fromUserTrueName, groupName, content, status, extTaskUser, isRemind, isRepeat, execPlan, label, uuid, relationCount, role } = this.state.detail || {};
    // const canReject = this.__getCanReject();
    let people = { type: '发起人', name: fromUserTrueName };
    const { RefreshComplete, replyList, NextDataComplete } = this.state;
    // let messageLength = 0;
    // if (Utility.isArray(messageList)) {
    //   messageLength = messageList.length;
    // }
    people = this.__getPeople();
    // const has = this.__hasButton();
    // const source = '来源：' + groupName ? groupName : '';
    const { Condition, List } = replyList || {};
    const { IsExistsNextData } = Condition || {};
    // const label = '紧急,重要,普通';
    // const isRemind = 'QUARTER';
    // const isRepeat = 'DAY';
    const { ExecutivePeople, RelationTask } = Utility.constItem.UrlItem;
    const participate = [
      { name: '执行计划', value: execPlan ? this.__ExecutePlanHtml(execPlan) : '轻任务', onItemClick: this.__emptyClick.bind(this) },
    ];
    // only  belong of standardTask 
    const standardTask = [
      { name: '提醒', value: this.__RemindHtml(isRemind), onItemClick: () => { } },
      { name: '标签', value: label ? this.__LabelStyle(label) : '无', onItemClick: () => { } },
      { name: '重复', value: this.__IsRepeatHtml(isRepeat), onItemClick: () => { } },
    ];
    const statusList = [
      { name: '状态', value: this.__getState(status), onItemClick: () => { } },
      { name: '接收人', value: this.__getExtTaskUser(extTaskUser), onItemClick: this.__toPage.bind(this, ExecutivePeople), showRight: true },
      { name: '相关任务', value: relationCount, onItemClick: () => { Utility.toPage(RelationTask, { uuid: uuid, role: role }); }, showRight: true },
    ];
    return (
      <div className={styles.content}>
        <Refresh RefreshComplete={RefreshComplete} NextDataComplete={NextDataComplete} onRefresh={this.__onRefresh.bind(this)} onNextData={this.__onNextData.bind(this)}>
          <div>
            <div className={styles.taskContent}>
              <div className={styles.peopleIcon} >
                <GxIcon IconType="headIcon" />
              </div>
              <div className={styles.des}>
                <div className={styles.peopleLine}>
                  <div className={styles.peopleName}>{people.name}</div>
                  <div className={styles.peopleAction}>{people.type}</div>
                </div>
                <div className={this.__onCheckCanEdit() ? styles.source : styles.sourcemax}>{groupName ? '来源：' + groupName : '来源：未知'}</div>
              </div>
              <div className={this.__onCheckCanEdit() ? styles.rejeact : styles.none} onClick={this.__onEditClick.bind(this)}>编辑</div>
            </div>
            <div className={styles.taskDes}>{content ? content : ''}</div>
            <InfoItemList InfoItems={participate} />
            {execPlan === 'STANDARD' && <InfoItemList InfoItems={standardTask} />}
            <InfoItemList InfoItems={statusList} />
            <ReplyList replyList={List} IsShowLoadingComplete={!IsExistsNextData} />
          </div>
        </Refresh>
        {this.__getButton()}
      </div>
    );
  }
}
